package com.gdteam.kernel.timer;

public interface TimerJob {

    /**
     * Perform job action
     * 
     */
    void perform();
    
    /**
     * Return timer job id
     * @return job id
     */
    String getId();
    
    /**
     * Get delay in milliseconds before job is to be executed
     * @return delay in milliseconds before job is to be executed
     */
    Long getDelay();
    
    /**
     * Get time in milliseconds between successive job executions
     * @return time in milliseconds between successive task executions (if return null, means that job must be executed once)
     */
    Long getPeriod();
    
    /**
     * Set time in milliseconds between successive job executions
     * @param period time in milliseconds between successive job executions
     */
    void setPeriod(Long period);
    
    /**
     * Set delay in milliseconds before job is to be executed
     * @param delay in milliseconds before job is to be executed
     */
    void setDelay(Long delay);
    
    /**
     * Suspend job
     */
    void suspend();
    
    /**
     * Resume job
     */
    void resume();
    
    /**
     * Return true if job is suspended
     * @return true if job is suspended
     */
    boolean isSuspended();

}
